package org.nuist.service.relation;

import org.nuist.pojo.Relation;
import org.nuist.pojo.User;
import org.nuist.pojo.VirtualMachine;

import java.util.List;

public interface RelationService {

    /**
     * 保存关联表
     * @author DYH
     * @param relation
     */
    public void save(Relation relation);

    /**
     * 删除关联表
     * @author DYH
     * @param relation
     */
    public void delete(Relation relation);

    /**
     * 查询全部关联表
     * @author DYH
     * @return List<Relation>
     */
    public List<Relation> findAll();

    /**
     * 根据id查询关联表
     * @author DYH
     * @param id
     * @return Relation
     */
    public Relation findRelationById(Integer id);

    /**
     * 更新关联表
     * @author DYH
     * @param relation
     */
    public void modifyRelation(Relation relation);

    /**
     * 根据关联表找到用户
     * @author DYH
     * @param id
     * @return User
     */
    public User findUserByRelationId(Integer id);

    /**
     * 根据关联表找到虚拟机
     * @author DYH
     * @param id
     * @return VirtualMachine
     */
    public VirtualMachine findVirtualMachineByRelationId(Integer id);

    /**
     * 根据userId寻找User
     * @author DYH
     * @param id
     * @return Integer
     */
    public Integer hasUser(Integer id);

    /**
     * 根据vmId寻找VirtualMachine
     * @author DYH
     * @param id
     * @return Integer
     */
    public Integer hasVM(Integer id);

    /**
     * 根据userId寻找relation
     * @author DYH
     * @param id
     * @return Relation
     */
    public Relation findRelationByUserId(Integer id);

    /**
     * 根据vmId寻找relation
     * @author DYH
     * @param id
     * @return Relation
     */
    public Relation findRelationByVMId(Integer id);

}
